<template>
  <div class="call">
    <el-row :gutter="20">
      <el-col :span="6" :xs="24">
        <el-card class="box-card">
          <template #header>
            <div class="clearfix">
              <span>{{ $t('router.personal_center.personal_information') }}</span>
            </div>
          </template>
          <div>
            <div class="text-center">
              <UserAvatar />
            </div>
            <ul class="list-group list-group-striped">
              <li class="list-group-item" v-for="data of user_data" :key="data.label">
                <span class="icon_left">
                  <svg-icon :icon-class="data.icon!" />
                  <span class="label">{{ data.label }}</span>
                </span>
                <div class="pull-right">{{ state.user[data.value] }}</div>
              </li>
            </ul>
          </div>
        </el-card>
      </el-col>
      <el-col :span="18" :xs="24">
        <el-card>
          <template #header>
            <div class="clearfix">
              <span>{{ $t('router.personal_center.basic_data') }}</span>
            </div>
          </template>
          <el-tabs v-model="activeTab">
            <el-tab-pane :label="$t('router.personal_center.basic_data')" name="userinfo">
              <UserInfo :user="state.user" />
            </el-tab-pane>
            <el-tab-pane :label="$t('router.personal_center.set_password')" name="resetPwd">
              <ResetPwd />
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script lang="ts" setup name="Personal">
import UserInfo, { GetUserDataType } from './_userInfo.vue'
import ResetPwd from './_setpassword.vue'
import UserAvatar from './_userAvatar.vue'
import { user_data } from '@/views/Personal/_personal'
const activeTab = ref<string>('userinfo')
const state = reactive<{ user: GetUserDataType }>({
  user: {
    userName: 'admin',
    phonenumber: '15991905246',
    email: 'tdx137330@163.com',
    sex: '0'
  }
})
</script>

<style scoped lang="scss">
.call {
  .list-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #e7eaec;
    border-top: 1px solid #e7eaec;
    font-size: 12px;
    .icon_left {
      display: flex;
      align-items: center;
      .label {
        margin-left: 5px;
      }
    }
  }
  .text-center {
    text-align: center;
  }
}
</style>
